//
//  WhetherToPassViewController.m
//  DistributorAB
//
//  Created by 主事丫环 on 2019/9/26.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "WhetherToPassViewController.h"

@interface WhetherToPassViewController ()<UITextViewDelegate>
@property (nonatomic, strong) UITextView *reasonTV;
@property (nonatomic, strong) UILabel *plLB;

@end

@implementation WhetherToPassViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = self.titlestr;
    [self.leftbutton setImage:imgname(@"left_icon") forState:(UIControlStateNormal)];
    self.view.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    
    [self showui];
    // Do any additional setup after loading the view.
}

- (void)showui {
    
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = [UIColor whiteColor];
    bgView.frame = CGRectMake(0, kNaviHeight+10, KWIDTH, 196);
    [self.view addSubview:bgView];
    
    UITextView *reasonTV = [[UITextView alloc] init];
    reasonTV.frame = CGRectMake(18, 24, KWIDTH-36, 132);
    reasonTV.layer.borderColor = [UIColor colorWithHexString:@"#CCCCCC"].CGColor;
    reasonTV.layer.borderWidth = 1;
    reasonTV.layer.cornerRadius = 8;
    reasonTV.layer.masksToBounds = YES;
    reasonTV.delegate = self;
    //[reasonTV becomeFirstResponder];
    [bgView addSubview:reasonTV];
    self.reasonTV = reasonTV;
    
    UILabel *plLB = [[UILabel alloc]initWithFrame:CGRectMake(10, 11, KWIDTH, 14)];
    plLB.textColor = [UIColor colorWithHexString:@"#B7B7B7"];
    plLB.text = @"请输入具体原因";
    plLB.font = FontSize(14);
    self.plLB = plLB;
    [self.reasonTV addSubview:plLB];
    
    //底部 提交留言按钮
    UIButton *bottomBtn = [[UIButton alloc] init];
    bottomBtn.frame = CGRectMake(28, bgView.bottom + 237, KWIDTH-56, 48);
    [bottomBtn setTitle:@"提交" forState:UIControlStateNormal];
    bottomBtn.titleLabel.font = FontSize(16);
    [bottomBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    bottomBtn.backgroundColor = [UIColor colorWithHexString:@"#70BE68"];
    bottomBtn.layer.cornerRadius = 5;
    [bottomBtn addTarget:self action:@selector(bottomBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bottomBtn];
}

//底部 提交留言按钮 点击事件
- (void)bottomBtnAction:(UIButton *)button {
    
    //[self requestData];
    NSLog(@"您点击了 底部 提交留言按钮");
}

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
    self.plLB.hidden = YES;
    return YES;
}

- (void)textViewDidEndEditing:(UITextView *)textView {
    if (textView.text.length < 1) {
        self.plLB.hidden = NO;
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
